<?php
//索引数组
/* 
$user1=array('u01','lcy','male','16');


$user1[]='student';
$user1[10]='show';
array_push($user1, 'c01');

$hobby=array('clibm','swim'); 
$user1[]=$hobby;
$user1['password']='123';

//print_r($user1);

//var_dump($user1);
foreach ($user1 as $key => $value) {
    if(is_array($value))
    {
     foreach ($value as $i => $v) {
     	echo $v.",";
     }

    }
    else

	{echo '<p>'.$value.'<p>';
}
}*/
//关联数组
/*$user1=array('uid'=>'u01','uname'=>'lcy','password'=>'123','age'=>'16','gender'=>'nan','type'=>'c01','hobby'=>array('climb','swim','trval'),'intro'=>'show');
foreach ($user1 as $key => $value) {
	echo '<p>';
	if (is_array($value)) {
		foreach ($value as $v) {
			echo $v." ";
		}
	}
	echo $key.":".$value;
	echo "</p>";
}
*/
//二维数组
/*$user1=array('uid'=>'u01','uname'=>'lcy','age'=>'16','gender'=>'nan','type'=>'c01','hobby'=>array('climb','swim','trval'),'intro'=>'show');
$user2=array('uid'=>'u02','uname'=>'eee','age'=>'116','gender'=>'nn','type'=>'c02','hobby'=>array('climb','swim','trval'),'intro'=>'show');
$user3=array('uid'=>'u03','uname'=>'ess','age'=>'116','gender'=>'nn','type'=>'c02','hobby'=>array('climb','swim','trval'),'intro'=>'show');
$user4=array('uid'=>'u03','uname'=>'ee','age'=>'116','gender'=>'nn','type'=>'c02','hobby'=>array('climb','swim','trval'),'intro'=>'show');
$userarr=array($user1,$user2,$user3,$user4);
//var_dump($userarr);
echo "<table align='center' border='1'>";
echo "<tr><th>id</th><th>age</th><th>hobby</th><th>gender</th><th>degree</th><th>type</th><th>intro</th></tr>";

foreach ($userarr as $i => $user) {
	echo "<tr>";
	foreach ($user as $k => $v) {
		echo "<td>";
		if(is_array($v)){
           $v=implode(",", $v);

		}
		echo $v;
		echo "</td>";
	}
	echo "</tr>";
}

echo "</table>";
*/
//多维数组
$user1=array('tid'=>'u01','tname'=>'student');
$user2=array('tid'=>'u02','tname'=>'busyness');
$user3=array('tid'=>'u03','tname'=>'ess');
$user4=array('tid'=>'u04','tname'=>'ee',);
$userarr=array($user1,$user2,$user3,$user4);
//var_dump($userarr);
echo "<table align='center' border='1'>";

echo "<tr><th>222</th>><th>id</th><th>age</th><th>hobby</th><th>gender</th><th>degree</th><th>type</th><th>intro</th></tr>";

foreach ($userarr as $i => $user) {
	echo "<tr>";
	echo "<td>".($i+1)."</td>";
	foreach ($user as $k => $v) {
		echo "<td>";
		if(is_array($v)){
           $v=implode(",", $v);

		}
		echo $v;
		echo "</td>";
	}
	echo "</tr>";
}

echo "</table>";






 ?>